<template>
	<view>
		<view class="topbgc">
			<view class="mainpadding">
				<view class="flexbetween">
					<view class="xiaobai bigtext fonweight">{{$t('mine.grzx')}}</view>
					<headertop></headertop>
				</view>
				<view class="margin_top6 flexbetween" v-if="!is_login" @click="jumpurl('/pages/login')">
					<view class="flexleft">
						<image src="@/static/image/system/weidenglu.png" class="headimg margin_right3" mode=""></image>
						<view class="xiaobai bigtext fonweight">{{$t('mine.wdl')}}</view>
					</view>
					<u-icon name="arrow-right" color="#fff" size="28" ></u-icon>
				</view>
				<view class="margin_top6 flexbetween" v-if="is_login">
					<view class="flexleft" @click="jumpurl('/pages/mine/bianjizl')">
						<image :src="userInfo.avatar" class="headimg margin_right3" mode=""></image>
						<view class="">
							<view class="xiaobai bigtext fonweight">{{userInfo.nickName}}</view>
							<view class="xiaobai margin_top2 ershil">{{$t('mine.yhid')}}:{{userInfo.userId}}</view>
						</view>
					</view>
					<u-icon name="setting" color="#fff" size="28"  @click="jumpurl('/pages/mine/shezhi')"></u-icon>
				</view>
				<view class="mainpadding_top ffffff radius">
					<view class="xiaohei sanshier fonweight">{{$t('mine.cygn')}}</view>
					<view class="flexleft">
						<view class="flexcolumn margin_top" @click="jumpurl('/pages/index/personHome')">
							<image src="@/static/image/system/my1.png" class="myicon" mode=""></image>
							<view class="smalltext xiaohei margin_top1">{{$t('mine.wddw')}}</view>
						</view>
					</view>
					<!-- <view class="flexleft">
						<view class="flexcolumn margin_top" @click="jumpurl('/pages/index/checkAddress')">
							<image src="@/static/image/system/my1.png" class="myicon" mode=""></image>
							<view class="smalltext xiaohei margin_top1">选择地址</view>
						</view>
					</view> -->
				</view>
				<view class="mainpadding_top ffffff radius">
					<view class="xiaohei sanshier fonweight">{{$t('mine.gdgn')}}</view>
					<view class="flexleft">
						<view class="flexcolumn margin_top margin_right3" @click="jumpurl('/pages/mine/gengduofw')">
							<image src="@/static/image/system/my4.png" class="myicon" mode=""></image>
							<view class="smalltext xiaohei margin_top1">{{$t('mine.gdgn')}}</view>
						</view>
						<view class="flexcolumn margin_top margin_right3" @click="kfshow=true">
							<image src="@/static/image/system/my2.png" class="myicon" mode=""></image>
							<view class="smalltext xiaohei margin_top1">{{$t('mine.zxkf')}}</view>
						</view>
						<view class="flexcolumn margin_top" @click="jumpurl('/pages/mine/yijianfk')">
							<image src="@/static/image/system/my3.png" class="myicon" mode=""></image>
							<view class="smalltext xiaohei margin_top1">{{$t('mine.yjfk')}}</view>
						</view>
					</view>
				</view>
			</view>
		</view>
		<u-popup :show="kfshow" @close="kfshow = false" round="10" mode="center">
			<view class="mainpadding4 flexcolumn radius" style="min-width: 500rpx;">
				<view class="sanshier xiaohei fonweight">{{$t('mine.zxkfc')}}</view>
				<view class="xiaolan fonweight sanshier margin_top" style="text-decoration: underline;" @click="callphone(kfMobile.protocolContent)">{{kfMobile.protocolContent}}</view>
				<view class="xiaolan bigtext fonweight margin_top6" @click="copy(kfMobile.protocolContent);kfshow=false">{{$t('mine.fz')}}</view>
			</view>
		</u-popup>
	</view>
</template>

<script>
	const httpRequest = require("@/common/httpRequest.js")
	export default {
		data() {
			return {
				kfshow:false,
				is_login: false,
				userInfo:{},
				kfMobile:{}
			}
		},
		onShow() {
			this.is_login = httpRequest.checkIsLogin();
			if (this.is_login) {
				this.init()
			} else {
				this.userInfo = {}
			}
		},
		onLoad() {
			this.getsystem()
		},
		methods: {
			getsystem(){
				httpRequest.request('/api/v1/protocol/getProtocol', 'GET', {
					protocolType:"kefu"
				}).then(res => {
					this.kfMobile = res.data
				})
			},
			init() {
				httpRequest.request('/api/v1/users/getUserInfo', 'GET', {}).then(res => {
					this.userInfo = res.data
				})
			},
			jumpurl(url) {
				if (!httpRequest.checkIsLogin()) {
					uni.navigateTo({
						url: "/pages/login"
					})
					return false
				}
				uni.navigateTo({
					url
				})
			}
		}
	}
</script>

<style>
	.topbgc{
		background: linear-gradient(180deg, #3e9bfe 0%, #f7fbfe 100%);
		height: 375rpx;
		width: 100%;
		box-sizing: border-box;
	}
page{
	background-color: #f7fbfe;
}
.headimg{
	width: 150rpx;
	height: 150rpx;
	box-sizing: border-box;
	border-radius: 50%;
}
.myicon{
	width: 75rpx;
	height: 75rpx;
}
</style>
